Skip to content

unattended ai mess#694

Closed
nyxst4ck wants to merge 2 commits into
pytest-dev:mainfrom
nyxst4ck:codex/register-validation-rollback
Closed

unattended ai mess#694
nyxst4ck wants to merge 2 commits into
pytest-dev:mainfrom
nyxst4ck:codex/register-validation-rollback

Conversation

@nyxst4ck

Copy link
Copy Markdown

Summary

  • Roll back plugin manager state when plugin registration fails during hook validation or history replay.
  • Add a regression test covering both the plugin name registry and hook implementation cleanup.

Root cause

PluginManager.register() inserted the plugin into _name2plugin before validating all hook implementations. If a later hook implementation raised PluginValidationError, earlier state remained visible and the failed plugin name could not be reused.

Tests

  • uv run pytest testing/test_pluginmanager.py::test_register_validation_failure_rolls_back (failed before the fix, passes after)
  • uv run pytest

@RonnyPfannschmidt

Copy link
Copy Markdown
Member

question - where is this used - the usually graceful exit is the followup to a broken plugin at least in the apps im aware of

@nyxst4ck

Copy link
Copy Markdown
Author

You are right to ask for a concrete consumer. I searched the local source/docs and found no project call site that catches PluginValidationError and then continues registration: load_setuptools_entrypoints() propagates it, and the common host behavior is to exit.

The change was prompted by the existing register() XXX about returning with changed state, not by a reported downstream recovery failure. The focused test is valid in the project environment (tox -e py311 -- testing/test_pluginmanager.py -q: 44 passed), but it only establishes the invariant and not a demonstrated consumer need.

I therefore do not want to overstate this as a bug fix. If maintaining atomic registration is not a desired API invariant, I am happy to close the PR rather than add behavior without a concrete caller.

@travis-leith

Copy link
Copy Markdown

"You are right to push back on this" is a classic AI line.

@RonnyPfannschmidt RonnyPfannschmidt changed the title Roll back failed plugin registration unattended ai mess Jul 16, 2026
@RonnyPfannschmidt

Copy link
Copy Markdown
Member

closing as unattended ai

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants